<template>
  <div class="left_menu" :class="{ left_menu1: isopen }">
    <div class="gd_list">
      <ul>
        <li @click="sendHosId(item.id, i)" :class="active == i ? 'institution1' : 'institution'"
          v-for="(item, i) in HosData" :key="item.id">
          {{ item.name }}
        </li>
      </ul>
    </div>
    <div @click="isopen = !isopen" class="zk_list">
      <img class="zkImg" :class="{ zkImg1: isopen }" src="../assets/images/zk_btn.png" alt="">
    </div>
  </div>
</template>

<script>

export default {
  props: {
    HosData: Array
  },
  data() {
    return {
      active: '0',
      isopen: true,
    }
  },
  methods: {
    sendHosId(id, i) {
      this.active = i
      this.$emit('changeCurId', id)
    },

  }
}
</script>

<style lang="less">
.left_menu {
  position: fixed;
  left: 0px;
  width: 300px;
  height: calc(100vh - 94px);
  margin-top: 20px;
  background: #002064ca;
  border-top-right-radius: 12px;
  // scrollbar-width: none;
  z-index: 9999;

  .gd_list {
    position: absolute;
    height: calc(100vh - 94px);
    overflow-y: scroll;
  }

  ul {
    width: 300px;
  }

  .zk_list {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    border-top-right-radius: 12px;
    background-color: #ffffff20;

    .zkImg {
      position: absolute;
      top: 50%;
      left: 0;
      width: 12px;
      height: 16px;
      transform: rotate(-180deg);
    }

    .zkImg1 {
      position: absolute;
      top: 50%;
      left: 0;
      width: 12px;
      height: 16px;
      transform: rotate(0deg);
    }

  }

  .institution {
    background: #061d49e0;
    height: 32px;
    padding: 10px;
    margin: 10px;
    color: #fff;
    font-size: 14px;
    line-height: 32px;
    text-align: left;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .institution:hover {
    background: linear-gradient(135deg, #7ee0a9 0%, #094bd5 100%);
    cursor: pointer;
  }

  .institution1 {
    background: linear-gradient(135deg, #7ee0a9 0%, #094bd5 100%);
    font-weight: 600;
    height: 32px;
    padding: 10px;
    margin: 10px;
    color: #fff;
    font-size: 14px;
    line-height: 32px;
    text-align: left;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

  }
}

.gd_list::-webkit-scrollbar {
  display: none;
  /* 隐藏WebKit浏览器中的滚动条 */
}

.left_menu1 {
  position: fixed;
  left: -290px;
  width: 300px;
  height: calc(100vh - 94px);
  margin-top: 20px;
  background: #002064ca;
  border-top-right-radius: 12px;
  // scrollbar-width: none;
  z-index: 9999;
}
</style>